<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>XCenter Administrator's Control Panel</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta content="Comsenz Inc." name="Copyright"/>
    <link rel="stylesheet" href="images/index.css"/>
    <link rel="stylesheet" href="img/dtree.css" type="text/css"/>
    <script src="include/js/dtree.js" type="text/javascript"></script>
    <script src="include/js/common.js" type="text/javascript"></script>
</head>
<body style="margin: 0px" scroll="no">
<div id="append_parent"></div>
<!--{!#menu}-->
<!--{!&actions}-->
<!--{&index_include.php}-->

<table cellpadding="0" cellspacing="0" width="100%" height="100%">
    <tr>
        <td colspan="2" height="85">
            <div class="mainhd">

                <div class="logo">XCenter</div>
                <div class="uinfo">
                    <p>您好, <em>${userid!}</em> [ <a href="#{/x,/index/logout}#" target="_top">退出</a> ]</p>
                </div>
                <div class="nav">
                    <ul id="topmenu">
                        <!--{@foreach($menus as $k => $v){
                            showheader($k,$v[0][1],$_XT_LANG);}
                        @}-->
                    </ul>
                    <div class="currentloca">
                        <p id="admincpnav"></p>
                    </div>
                    <div class="navbd"></div>
                    <div class="sitemapbtn">

                        <div style="float: left; margin:-5px 10px 0 0">
                            <form name="search" method="post" action="admincp.php?action=search" target="main"><input
                                    type="text" name="keywords" value="" class="txt"/> <input type="hidden"
                                                                                              name="searchsubmit"
                                                                                              value="yes"
                                                                                              class="btn"/><input
                                    type="submit" name="searchsubmit" value="搜索" class="btn"
                                    style="margin-top: 3px;vertical-align:middle"/></form>
                        </div>
                        <span ><a id="add2custom" href="" target="main"><img src="images/btn_add2menu.gif" title="" width="19" height="18" /></a></span>
                        <a href="javascript:;" id="cpmap" onclick="showMap();return false;">
                            <img src="images/btn_map.gif"
                                 title="后台导航" width="72"
                                 height="18"/></a>
                    </div>
                </div>
            </div>
        </td>
    </tr>
    <tr>
        <td valign="top" width="160" class="menutd" >
            <div id="leftmenu" class="menu">
                <!--{@foreach($menus as $k => $v){
                    showmenu($k,$v);
                 }
                @}-->
                <ul id="menu_cms" style="display: none">
                    <script type="text/javascript">
                        <!--

                        var d = new dTree('d');
                        d.config.target = 'main';
                        d.add(1, -1, '内容管理');
                            d.add(10, 1, '内容分类');
                                d.add(101, 10, '添加分类', '#{/cms/addcategory}#');
                                d.add(102, 10, '管理分类', '#{/cms/category}#');
                                /*d.add(-23, -3, '合并栏目', '#{/cms/joincategory}#');
                                d.add(-24, -3, '批量添加', '#{/cms/batchcategory}#');*/

                            d.add(11, 1, '模型管理');
                                d.add(111, 11, '添加模型', '#{/cms/addmodel}#');
                                d.add(112, 11, '管理模型', '#{/cms/model}#');

                            d.add('c0', 1, '内容管理');
                                d.add(121, 'c0', '全部内容','#{/cms/content}#');
                                {loop $categorys $v}
                                    d.add('c${v[catid]}', 'c${v[parentid]}', '${v[catname]}','#{/cms/content/${v[catid]}}#');
                                {pool}
                            d.add(13, 1, '站点管理');
                                d.add(131, 13, '新建站点', '#{/cms/newsite}#');
                                d.add(132, 13, '添加栏目', '#{/cms/addsite}#');
                                d.add(133, 13, '管理站点', '#{/cms/site}#');
                            d.add('s0', 1, '内容发布');
                                d.add(141, 's0', '全部发布','#{/cms/released}#');
                                {loop $sites $v}
                                    d.add('s${v[siteid]}', 's${v[parentid]}', '${v[sitename]}','#{/cms/released/${v[siteid]}}#');
                                {pool}
                        document.write(d);

                        //-->
                    </script>
                </ul>
            </div>
        </td>
        <td valign="top" width="100%" class="mask">
            <iframe src="#{/index/home}#"  id="main" name="main" width="100%" height="100%" frameborder="0" style="overflow: visible;"></iframe>
        </td>
    </tr>
</table>

<div class="copyright">
    <p>Powered by <a href="http://www.openxtiger.org/" target="_blank">openXtiger</a> 1.0.0</p>

    <p>&copy; 2009, <a href="http://www.microsoul.com.cn/" target="_blank">Microsoul Inc.</a></p>

</div>

<div id="cpmap_menu" class="custom" style="display:none">
    <div class="cside">
        <h3><span class="ctitle1"></span><a href="javascript:;"
                                            onclick="toggleMenu('tool', 'misc&operation=custommenu');hideMenu();"
                                            class="cadmin">管理</a></h3>
        <ul class="cslist" id="custommenu"></ul>
    </div>
    <div class="cmain" id="cmain"></div>
    <div class="cfixbd"></div>
</div>

<script type="text/JavaScript">
    function $(id) {
        return document.getElementById(id);
    }
    var headers = new Array(<!--{@ $d='';foreach($menus as $k=>$v){echo "$d'$k'";$d=',';}@}-->);
    function toggleMenu(key, url) {
        if (key == 'index' && url == '#{/index/home}#') {
            if (is_ie) {
                doane(event);
            }
            parent.location.href = parent.location.href;
            return false;
        }
        for (var k in headers) {
            if ($('menu_' + headers[k])) {
                $('menu_' + headers[k]).style.display = headers[k] == key ? '' : 'none';
            }
        }
        var lis = $('topmenu').getElementsByTagName('li');
        for (var i = 0; i < lis.length; i++) {
            if (lis[i].className == 'navon') lis[i].className = '';
        }
        $('header_' + key).parentNode.parentNode.className = 'navon';

        if (url) {
            parent.main.location = url;
            var hrefs = $('menu_' + key).getElementsByTagName('a');
            for (var j = 0; j < hrefs.length; j++) {
                hrefs[j].className = hrefs[j].href.indexOf(url) != -1 ? 'tabon' : (hrefs[j].className == 'tabon' ? '' : hrefs[j].className);
            }
        }
        return false;
    }
    function initCpMenus(menuContainerid) {
        var key = '';
        var hrefs = $(menuContainerid).getElementsByTagName('a');
        for (var i = 0; i < hrefs.length; i++) {
            //alert(hrefs[i].href)
            if (menuContainerid == 'leftmenu' && !key && hrefs[i].href.indexOf('/home') != -1) {
                key = hrefs[i].parentNode.parentNode.id.substr(5);
                hrefs[i].className = 'tabon';
            }
            if (!hrefs[i].getAttribute('ajaxtarget')) hrefs[i].onclick = function() {
                if (menuContainerid != 'custommenu') {
                    var lis = $(menuContainerid).getElementsByTagName('li');
                    for (var k = 0; k < lis.length; k++) {
                        if (lis[k].firstChild.className != 'menulink') lis[k].firstChild.className = '';
                    }
                    if (this.className == '') this.className = menuContainerid == 'leftmenu' ? 'tabon' : 'bold';
                }
                if (menuContainerid != 'leftmenu') {
                    var hk, currentkey;
                    var leftmenus = $('leftmenu').getElementsByTagName('a');
                    for (var j = 0; j < leftmenus.length; j++) {
                        hk = leftmenus[j].parentNode.parentNode.id.substr(5);
                        if (this.href.indexOf(leftmenus[j].href) != -1) {
                            leftmenus[j].className = 'tabon';
                            if (hk != 'index') currentkey = hk;
                        } else {
                            leftmenus[j].className = '';
                        }
                    }
                    if (currentkey) toggleMenu(currentkey);
                    hideMenu();
                }
            }
        }
        return key;
    }
    var header_key = initCpMenus('leftmenu');
    toggleMenu(header_key ? header_key : 'index');
    function initCpMap() {
        var ul, hrefs, s;
        s = '<ul class="cnote"><li><img src="images/btn_map.gif" /></li><li> 按 “ ESC ” 键展开 / 关闭此菜单</li></ul><table class="cmlist" id="mapmenu"><tr>';

        for (var k in headers) {
            if (headers[k] != 'index' && headers[k] != 'uc') {
                s += '<td valign="top"><ul class="cmblock"><li><h4>' + $('header_' + headers[k]).innerHTML + '</h4></li>';
                ul = $('menu_' + headers[k]);
                hrefs = ul.getElementsByTagName('a');
                for (var i = 0; i < hrefs.length; i++) {
                    s += '<li><a href="##' + hrefs[i].href + '" target="' + hrefs[i].target + '" k="' + headers[k] + '">' + hrefs[i].innerHTML + '</a></li>';
                }
                s += '</ul></td>';
            }
        }
        s += '</tr></table>';
        return s;
    }
    $('cmain').innerHTML = initCpMap();
    initCpMenus('mapmenu');
    var cmcache = false;
    function showMap() {
        showMenu('cpmap', true, 3, 3);
        //if (!cmcache) ajaxget(admincpfilename + '?action=misc&operation=custommenu&' + Math.random(), 'custommenu', '');
    }
    function resetEscAndF5(e) {
        e = e ? e : window.event;
        actualCode = e.keyCode ? e.keyCode : e.charCode;
        if (actualCode == 27) {
            if ($('cpmap_menu').style.display == 'none') {
                showMap();
            } else {
                hideMenu();
            }
        }
        if (actualCode == 116 && parent.main) {
            parent.main.location.reload();
            if (document.all) {
                e.keyCode = 0;
                e.returnValue = false;
            } else {
                e.cancelBubble = true;
                e.preventDefault();
            }
        }
    }
    function _attachEvent(obj, evt, func, eventobj) {
        eventobj = !eventobj ? obj : eventobj;
        if (obj.addEventListener) {
            obj.addEventListener(evt, func, false);
        } else if (eventobj.attachEvent) {
            obj.attachEvent("on" + evt, func);
        }
    }
    _attachEvent(document.documentElement, 'keydown', resetEscAndF5);

</script>

</body>
</html>
